package practice.network.tools;

import com.google.gson.Gson;
import com.google.gson.JsonObject;

public class HttpClientUtil {

	public static void main(String args[]) {

		JsonObject json = httpget("https://api.battlenet.com.cn/d3/profile/suigara-5185/?locale=zh_CN&apikey=aanwqrv36q4waukbrq4gh77yn89wzxxv");
		System.out.println(json.get("battleTag").getAsString());
	}

	public static JsonObject httpget(String url) {

		String responseBody = httpgetString(url);

		Gson gson = new Gson();
		return gson.fromJson(responseBody, JsonObject.class);

	}

	private static String httpgetString(String url) {
		return HttpRequest.sendGet(url);
	}

}
